import streamlit as st
# 参考: https://discuss.streamlit.io/t/dynamic-buttons/7723/2
buttons = []

for i in range(5):
    button = st.button(str(i))
    print('type: ', type(button), button)
    buttons.append(button)

for i, button in enumerate(buttons):
    if button:
        st.write(f"{i} button was clicked")